<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>TreeHole Admin</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<link type="text/css" href="${pageContext.request.contextPath }/css/global.css" rel="stylesheet" />
		<link type="text/css" href="${pageContext.request.contextPath }/css/accordion.css" rel="stylesheet" />
		<link type="text/css" href="${pageContext.request.contextPath }/css/dialog.css" rel="stylesheet" />
		
		<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.6.2.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-ui-1.8.16.custom.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath }/js/resEditDialog.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath }/js/resAddDialog.js"></script>
	</head>
	<body>
		<div class="box">
			<div class="title">
				<div class="tle">【资源列表】</div>
				<a class="btn add resAddDialog" href="javascript:void(0);" onclick="">&nbsp;添加</a>
			</div>
			<div class="con">
				<table cellpadding="0" cellspacing="0">
					<thead>
						<tr>
							<td>资源名称</td>
							<td>资源路径</td>
							<td>资源描述</td>
							<td>操作</td>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${resourceList }" var="resource">
							<tr>
								<td>${resource.name }</td>
								<td>${resource.url }</td>
								<td>${resource.description }</td>
								<td>
									<a class="resEditDialog handler" href="javascript:void(0)" value="${resource.id }">修改</a>&nbsp;&nbsp;&nbsp;&nbsp;
									<a class="resDel handler" href="javascript:void(0)"  value="${resource.id }" >删除</a>
								</td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
		</div>
		<jsp:include page="/pages/ResourceEdit.jsp"></jsp:include>
		<jsp:include page="/pages/ResourceAdd.jsp"></jsp:include>
		<script type="text/javascript">
			$(".resDel").click(function () {
				if(confirm("确认删除？")) {
					window.location.href = "${pageContext.request.contextPath }/pages/resource_del.do?resource.id=" + $(this).attr("value");
				}
			});
		</script>
	</body>
	
</html>
